class BootStrap {

    def init = { servletContext ->
        // User
        User user = new User(name:"최종욱", email:"choi@gmail.com", password:"pass")
        user.save()
        //new User(name:"장민석", email:"jang@gmail.com", password:"pass").save()


        // Currency
        /*
        MyCurrency usd = new MyCurrency(shortName:"USD", fullName:"US Dollar", sign:"\$", unitAmount:1, perDollar:1)
        usd.save()
        MyCurrency yen = new MyCurrency(shortName:"JPY", fullName:"Japanese Yen", sign:"￥", unitAmount:100, perDollar:100)
        yen.save()
        */

        // Country
        /*
        Country usa = new Country(name:"USA", myCurrency:usd)
        usa.save()
        Country japan = new Country(name:"Japan", myCurrency:yen)
        japan.save()
        */
        Country usa = new Country(name:"USA")
        usa.save()
        Country japan = new Country(name:"Japan")
        japan.save()
        // Places
        Place tower = new Place(name:"Japan National Tower", latitude:1, longitude:1, wikipediaEntry:"COEX")
        tower.save()
        Place library = new Place(name:"The Great Library", latitude:1, longitude:2, wikipediaEntry:"Library")
        library.save()
        Place hotel = new Place(name:"Tokyo Hotel", latitude:1, longitude:2, wikipediaEntry:"Hotel")
        hotel.save()
        Place temple = new Place(name:"Yasukuni Honden", latitude:1, longitude:2, wikipediaEntry:"Yasukuni Honden Tokyo")
        temple.save()
        japan.addToPlaces(tower)
        japan.addToPlaces(library)
        japan.addToPlaces(hotel)
        japan.addToPlaces(temple)
        japan.save()
         Place statue = new Place(name:'Statue of Liberty',
             latitude:40.693889, longitude:-74.043611, wikipediaEntry:'Statue_of_Liberty')
         statue.save()
         Place centralPark = new Place(name:'Central Park',
             latitude:40.781944, longitude:-73.966111, wikipediaEntry:'Central_Park')
         centralPark.save()
         Place empireStateBuilding = new Place(name:'Empire State Building',
             latitude:40.748433, longitude:-73.985655, wikipediaEntry:'Empire_State_Building')
         empireStateBuilding.save()
         Place wtc = new Place(name:'World Trade Center',
             latitude:40.711667, longitude:-74.0125, wikipediaEntry:'World_Trade_Center')
         wtc.save()
        usa.addToPlaces(statue)
        usa.addToPlaces(centralPark)
        usa.addToPlaces(empireStateBuilding)
        usa.addToPlaces(wtc)
        usa.save()


        // Plan
        Plan tokyoPlan = new Plan(name:"Tokyo Traveling", travelCountry:japan)
        tokyoPlan.save()
        user.addToPlans(tokyoPlan)
        /*
        Plan washingtonDcPlan = new Plan(name:"Washington D.C.", travelCountry:usa)
        user.addToPlans(washingtonDcPlan)
        washingtonDcPlan.save()
        */
        Plan nyPlan = new Plan(name:"New York", travelCountry:usa)
        nyPlan.save()
        user.addToPlans(nyPlan)
        user.save()
        // Plan items
        tokyoPlan.addToItems(new PlanItem(place:tower, date:new Date()))
        tokyoPlan.addToItems(new PlanItem(place:library, date:new Date()))
        tokyoPlan.addToItems(new PlanItem(place:hotel, date:new Date()))
        tokyoPlan.save()

        nyPlan.addToItems(new PlanItem(place:statue, date:new Date()))
        nyPlan.addToItems(new PlanItem(place:centralPark, date:new Date()))
        nyPlan.addToItems(new PlanItem(place:empireStateBuilding, date:new Date()))
        nyPlan.save()
    }
    def destroy = {
    }
} 